<?php
global $base_dir;
$base_dir='../';

/**** 模块调用*****/
include_once($base_dir."inc/inc_connect.php");		//通用函数包含文件
include_once("index_inc.php");
include_once("func/function.php");
include_once($base_dir."inc/manage.php");			//后台通用包含文件
include_once("../msg/api/msg_mdlAPI.php");					//短信API
?>
<?php
//接收参数
if(is_array($_GET))
{
	foreach($_GET as $key => $value)
	{
		$$key=$value;
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$lanmu_name?>-后台管理系统</title>
<link href="../style/common.css" rel="stylesheet" type="text/css" />
<script src="../js/checkform.js" type="text/javascript"></script>
<script src="../js/common.js" type="text/javascript"></script>
<script src="../js/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/kindeditor/kindeditor.js"></script>

<link href="../js/dq_calendar/dq_calendar.css" rel="stylesheet" type="text/css" />
<script src="../js/dq_calendar/dq_calendar.js" type="text/javascript"></script>
<script language="javascript">
//表单验证
function this_submit()
{
	if(checkform())
	{
		document.f1.submit();
	}
}
</script>
</head>
<body>
<?php
$t=new Tbl_Act($tbl_name,$tbl_key);		//创建表对象
$t->$tbl_key=$_GET['id'];
$t->GetOne(array($tbl_key.',='));
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="lanmu_table">
  <tr>
    <td height="30" valign="bottom"><a href="<?=$url_list?>"><span class="lanmu_title"><?=$lanmu_name?></span></a><span class="lanmu_title2">&nbsp;&gt;&nbsp;修改</span></td>
  </tr>
</table>
<form action="<?=$url_act?>?<?=QueryString()?>" method="post" name="f1" enctype="multipart/form-data">
  <table border="0" cellspacing="1" class="margintop30">
  <tr>
		<td width="114" height="25" align="right" class="title01">门票名称:</td>
		<td width="616" class="list_content1"><label><input name="Tord_ticketName" type="text" id="Tord_ticketName" value="<?=$t->Tord_ticketName?>" bt="1" char="门票名称"/><span class="red">*</span>
		&nbsp;&nbsp;</label></td>
	  </tr>
  <tr>
    <td height="25" align="right" class="title01">客户名称:</td>
    <td class="list_content1"><?=getCstComById($t->Tord_cst_id)?></td>
  </tr>  
  <tr>
	  <td width="114" height="25" align="right" class="title01">游玩日期:</td>
	  <td width="616" class="list_content1"><label><input name="Tord_playdate" type="text" id="Tord_playdate" bt="1" char="游玩日期" onclick="DQ_setDate(this)" value="<?=$t->Tord_playdate==''?'':date("Y-m-d",$t->Tord_playdate)?>"/><span class="red">*</span>
	  &nbsp;&nbsp;</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">预订数量:</td>
		<td width="616" class="list_content1"><label><input name="Tord_num" type="text" id="Tord_num" value="<?=$t->Tord_num?>" char="预订数量"/>
		&nbsp;&nbsp;</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">窗口价格:</td>
		<td width="616" class="list_content1"><label><?=$t->Tord_price1?>
		&nbsp;&nbsp;</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">销售价:</td>
		<td width="616" class="list_content1"><label><?=$t->Tord_price2?>
		&nbsp;&nbsp;</label></td>
	  </tr>  
	  <tr>
		<td width="114" height="25" align="right" class="title01">订单单价:</td>
		<td width="616" class="list_content1"><label><input name="Tord_price3" type="text" id="Tord_price3" value="<?=$t->Tord_price3?>" char="订单单价" readonly="true"/>
		&nbsp;&nbsp;</label></td>
	  </tr>
	  <tr>
		<td width="114" height="25" align="right" class="title01">订单总价:</td>
		<td width="616" class="list_content1"><label><?=$t->Tord_price3*$t->Tord_num?>
		&nbsp;&nbsp;</label></td>
	  </tr> 
	  <tr>
		<td width="114" height="25" align="right" class="title01">额外返利:</td>
		<td width="616" class="list_content1"><label><input name="Tord_price4" type="text" id="Tord_price4" value="<?=$t->Tord_price4?>" char="额外返利"/>
		&nbsp;&nbsp;</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">游客姓名:</td>
		<td width="616" class="list_content1"><label><input name="per_name" type="text" id="per_name" value="<?=$t->per_name?>" bt="1" char="游客姓名"/><span class="red">*</span>
		&nbsp;&nbsp;</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">游客电话:</td>
		<td width="616" class="list_content1"><label><input name="per_phone" type="text" id="per_phone" value="<?=$t->per_phone?>" bt="1" char="游客电话"/><span class="red">*</span>
		&nbsp;&nbsp;</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">游客证件类型:</td>
		<td width="616" class="list_content1"><label><input name="per_cardtype" type="text" id="per_cardtype" value="<?=$t->per_cardtype?>" char="游客证件类型"/>
		</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">游客证件号码:</td>
		<td width="616" class="list_content1"><label><input name="per_cardno" type="text" id="per_cardno" value="<?=$t->per_cardno?>" char="游客证件号码"/>
		</label></td>
	  </tr>
	  <tr>
        <td height="25" align="right" class="title01">邮寄地址:</td>
	    <td class="list_content1"><input name="Tord_address" type="text" id="Tord_address" value="<?=$t->Tord_address?>"/></td>
    </tr>
	  <tr>
        <td height="25" align="right" class="title01">邮政编码:</td>
	    <td class="list_content1"><input name="Tord_code" type="text" id="Tord_code" value="<?=$t->Tord_code?>"/></td>
    </tr>
	    
	  <tr>
		<td width="114" height="25" align="right" class="title01">预订备注:</td>
		<td width="616" class="list_content1"><label><textarea name="per_beizhu" cols="40" id="per_beizhu" char="预订备注"><?=$t->per_beizhu?></textarea>
		&nbsp;&nbsp;</label></td>
	  </tr>  <tr>
		<td width="114" height="25" align="right" class="title01">订单状态:</td>
		<td width="616" class="list_content1"><label><select name="Tord_status" id="Tord_status">
	<option value="">请选择</option>
	<?
	echo getOrderStuOpt();	#获取订单状态列表
	?>
</select>
<?php
if($t->Tord_status!='')
{
	echo '<script language="javascript">setSelect_selected("'.$t->Tord_status.'","Tord_status");</script>';
}
?>
		&nbsp;&nbsp;</label></td>
	  </tr>
	  <tr>
	    <td height="25" align="right" class="title01">短信</td>
	    <td class="list_content1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="right">目标号码:</td>
              <td><input name="msg_phone" type="text" id="msg_phone" value="<?=$t->per_phone?>" bt="1" char="游客电话"/></td>
            </tr>
            <tr>
              <td align="right">模板类型:</td>
              <td><select name="msg_mdl" id="msg_mdl" onchange="showMsg()">
                <?
	echo getMdlOpt();	#获取订单状态列表
	?>
              </select></td>
            </tr>
            <tr>
              <td align="right" valign="middle">预&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;览:</td>
              <td valign="middle"><textarea name="mdl_content" cols="40" rows="5" id="mdl_content" char="模板内容"><?=$t->mdl_content?>
                </textarea>
              <input name="sendmsg" type="button" id="sendmsg" value="发送短信" onclick="sendMsg(this)" /></td>
            </tr>
          </table></td>
    </tr>
    <tr>
      <td height="25" colspan="2" align="center" class="list_content1"><input type="button" name="Submit2" value="提交" onclick="this_submit()" />
        &nbsp;&nbsp;
        <input name="reset" type="reset" value="重填" />
        <input name="<?=$tbl_key?>" type="hidden" id="<?=$tbl_key?>" value="<?=$id?>" />
        <input name="act" type="hidden" id="act" value="update" />      </td>
    </tr>
  </table>
</form>
</body>
<script language="javascript">
function showMsg()
{

	var msg_mdl=document.getElementById("msg_mdl").value;		//模板号
	var ordId=document.getElementById('<?=$tbl_key?>').value;		//订单号
	$.post("getMsgMdl.php",{ordId:ordId,msg_mdl:msg_mdl,act:'showMsg'},function(data){
		var obj=document.getElementById("mdl_content");
		obj.value=data;
	});
}

function sendMsg(obj)
{
	obj.disabled=true;
	var phone=G('msg_phone').value;
	var msg=G('mdl_content').value;
	$.post("getMsgMdl.php",{phone:phone,msg:msg,act:'sendMsg'},function(data){
		if(data=="1")
		{
			alert("发送成功");
		}
		else
		{
			alert("发送失败:\n"+data);
			obj.disabled=false;
		}
	}
	);
}

showMsg();
</script>
</html>
<?php
include_once($base_dir."inc/inc_unconnect.php")
?>